package com.nf.health.app.adapter;

import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.nf.health.app.R;
import com.nf.health.app.customview.SwipeView;
import com.nf.health.app.customview.SwipeView.OnSwipeStatusChangeListener;
import com.nf.health.app.models.ScannerHistoryBean;
import com.nf.health.app.utils.DateUtil;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

/** 
 * @ClassName:
 * @Description: 要点支付  历史详情 适配器
 * @author Ian 
 * @date
 *  
 */
public class ScannerHistoryAdapter extends BaseAdapter {

	private Context context;
	private List<ScannerHistoryBean> doctors;
	private ArrayList<SwipeView> unClosedSwipeView = new ArrayList<SwipeView>();

	public ScannerHistoryAdapter(Context context, List<ScannerHistoryBean> doctors) {
		super();
		this.context = context;
		this.doctors = doctors;
	}

	@Override
	public int getCount() {
		return doctors.size();
	}

	@Override
	public Object getItem(int position) {
		return doctors.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		ViewHolder holder = new ViewHolder();
		if (convertView == null) {
			convertView = View.inflate(context, R.layout.item_scanner, null);
			holder = new ViewHolder();
			holder.name = (TextView) convertView.findViewById(R.id.hospital_name);
			holder.time = (TextView) convertView.findViewById(R.id.hospital_time);
			holder.money = (TextView) convertView.findViewById(R.id.hospital_money);

			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		
		holder.name.setText(doctors.get(position).getMemo());
		holder.time.setText(DateUtil.dateToString(new Date(Long.parseLong(doctors.get(position).getCreatetime())), "yyyy-MM-dd"));
		holder.money.setText(doctors.get(position).getAmount()+"元");

		return convertView;
	}
	static class ViewHolder {
		TextView name,time,money;
	}

}
